<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$infoConfig.site_title}</title>
    <meta name="keywords" content="FAKE Framework"/>
    <meta name="description" content="FAKE is a lightweight php framework."/>
    <meta name="author" content="tianji">
    <meta name="renderer" content="webkit">
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <!-- icon -->
    <link rel="icon" type="image/x-icon" href="/static/icon.png">
    <!-- css -->
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/font/iconfont.css?v=1.0.0" type="text/css" media="all">
    <style>
        body {
            padding: 0 10px;
        }

        .pagination li {
            float: left
        }

        .page-count {
            float: left;
            display: block;
            padding: 0 10px;
            margin: 10px 10px 10px 0;
            border: 1px solid #e2e2e2;
            line-height: 28px;
        }

        .page-footbtn {
            float: left;
            display: block;
            padding: 0 10px;
            margin: 10px 10px 10px 0;
            line-height: 30px;
            color: white;
        }

        .page-footbtn:hover {
            color: white;
        }

        .layui-collapse .layui-form .layui-inline {
            margin: 5px 0;
        }

        .layui-table .layui-btn-xs {
            margin: 5px 2px;
        }

        .ajax-sort{min-width: 28px !important;}
    </style>
</head>

{block name="body"}

{/block}
<script src="/static/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/admin/js/',
        version: true,
    }).extend({
        layajax: 'layajax'
    });

    layui.use(['jquery', 'element', 'layer', 'form'], function () {
        var $ = layui.jquery
            , layer = layui.layer
            , element = layui.element
            , form = layui.form;

        //表单submit监听
        form.on('submit(*)', function (data) {
            var action = $('.layui-form').attr('action');
            var ary = data.field;
            $.ajax({
                url: action,
                data: ary,
                type: "post",
                dataType: 'json',
                success: function (res) {
                    console.log('res', res);
                    //数据处理
                    if (res.code == 1) {
                        layer.msg(res.msg, {
                            time: 20000,
                            btn: ['返回列表', '留在此页'],
                            yes: function (index, layero) {
                                layer.close(index);
                                window.location.href = res.data.url;
                            },
                            btn2: function (index, layero) {
                                layer.close(index);
                            }
                        });
                    }
                    if (res.code == 0) {
                        layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                }, error: function (res) {
                    console.log(res);
                    layer.msg('致命错误');
                }
            });
            return false;
        });

        //表单search监听
        form.on('submit(search)', function (data) {
            console.log('搜索');
            $(this).submit();
        });

    });
</script>
<!--脚本文件开始-->
{block name="script"} {/block}
<!--脚本文件结束-->
</html>
